home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 10-02.C < prev    next >
Text File  |  1992-01-31  |  872b  |  43 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. void main()
  8. {
  9.    int new_mode, old_mode;
  10.    int x;
  11.  
  12.    /* initialize the video environment */
  13.  
  14.    new_mode = fg_bestmode(320,200,1);
  15.    if (new_mode < 0 || new_mode == 12) {
  16.       printf("This program requires a 320 ");
  17.       printf("x 200 color graphics mode.\n");
  18.       exit(1);
  19.       }
  20.    old_mode = fg_getmode();
  21.    fg_setmode(new_mode);
  22.  
  23.    /* draw some type of background */
  24.  
  25.    fg_setcolor(15);
  26.    fg_rect(0,319,0,199);
  27.  
  28.    /* move the object across the screen */
  29.  
  30.    for (x = -20; x < 320; x+=5) {
  31.       fg_setcolor(10);
  32.       fg_clprect(x,x+19,95,104);
  33.       fg_waitfor(1);
  34.       fg_setcolor(0);
  35.       fg_clprect(x,x+19,95,104);
  36.       }
  37.  
  38.    /* restore the original video mode and return to DOS */
  39.  
  40.    fg_setmode(old_mode);
  41.    fg_reset();
  42. }
  43.